package com.hhj.demo.controller;

import com.hhj.demo.base.Result;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

/**
 * TestController
 *
 * @author: KING
 * @create: 2018-07-27 13:38
 **/
@RestController
@RequestMapping(value = "/test")
public class TestController {

    @Value("${com.hhj.demo.controller.test.enable:true}")
    private Boolean testEnable;

    @GetMapping("/member/findInfoById")
    public Result<?> testFindInfoById(@RequestParam("userId") Integer userId) {
        if (!testEnable) {
            return Result.error();
        }
        Result<?> result = Result.success(userId);
        return result;
    }


    @RequestMapping(value = "/user/set", method = RequestMethod.GET)
    public Result setRedisCacheDatabaseEnums(@RequestParam("key") String key) {
        if (!testEnable) {
            return Result.error();
        }
        Result<?> result = Result.success(key);
        return result;
    }
}